<%@page import="com.entity.UserInfo"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>标题</title>
    
	<meta charset="UTF-8">
    <meta name="keywords" content="keyword1,keyword2,keyword3">
    <meta name="description" content="this is my page">
    <meta name="content-type" content="text/html; charset=UTF-8">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<style type="text/css">
		.index-title{
			width: 100%;
			height: 30px;
			margin: 0px auto;
			padding: 0px;
			border-radius: 10px;
		}
		.title-h{
			display: inline-block;
			margin-left: 15px;
			margin-top: 15px;
			text-shadow: 10px -2px 10px #f5f5f5;
			color: white;
		}
		.index-title>span{
			float: right;
			margin-top: 30px;
		}
		#login-info>span{
			display: inline-block;
			margin: 0px 5px;
		}
		.index-title a{
			display: inline-block;
			text-decoration: none;
			color: blue;
		}
		.index-title a:hover{
			text-decoration: underline;
			color: orange;
		}
		#query{
			background: white;
			border: 1px solid white;
			border-radius: 20px;
			padding: 0px;
		}
		#query>input{
			width: 100px;
			padding: 2px 10px;
			border: none;
			outline: none;
			border-radius: 20px 0px 0px 20px;
		}
		#query>a{
			text-decoration: none;
			display: inline-block;
			border-left: 1px solid #dcdcdc;
			padding: 2px 10px;
			border-radius: 0px 20px 20px 0px;
			font-size: 15px;
		}
		#query>a:hover{
			background: orange;
			color: white;
		}
	</style>
	<script src="js/jquery-1.12.4.js"></script>
	<script type="text/javascript">
		function login(){
			parent.location="/myweb2/login.jsp";
		}
		function reg(){
			parent.location="/myweb2/reg.jsp";
		}
		function index(){
			parent.location="/myweb2/index.jsp";
		}
		function isloginout(){
			if(confirm("你确定要退出吗？")){
				location="/myweb2/doLoginOut";
			}
		}
		function queryPro(){
			var key=$("input[name='key']").val();
			parent.location="/myweb2/index.jsp?key="+key;
		}
		
		$(function(){
			$("input[name='key']").focus(function(){
				var key=$(this).val();
				if(key=="苹果"){
					var key=$(this).val("");
				}
			});
			$("input[name='key']").blur(function(){
				var key=$(this).val();
				if(key==""){
					var key=$(this).val("苹果");
				}
			});
		});
	</script>
  </head>
  
  <body>
   	<div class="index-title">
   			<h1 class="title-h">网上购物商城</h1>
	  		<span id="login-info">
	  			<span id="query">
	  				<input type="text" name="key" placeholder="苹果" value="苹果"/><a href="javascript:queryPro()">搜索</a>
	  			</span>
	  			<span id="links">
	  				<span><a href="javascript:index()">商城首页</a></span>
	  			</span>
	  			<c:choose>
	  			<c:when test="${empty loger || loger.isadmin!=0 }">
		  		<span><a href="javascript:login()">登录</a></span>
		  		<span><a href="javascript:reg()">注册</a></span>
		  		</c:when>
		  		<c:otherwise>
		  		<span><a href="/myweb2/user/showMyShopCart.jsp" target="_parent">我的购物车</a></span>
		  		<span><a href="/myweb2/user/orders" target="_parent">我的订单</a></span>
		  		<span><a href="/myweb2/user/address" target="_parent">地址管理</a></span>
		  		<span>欢迎您：${loger.uname }</span>
		  		<span><a href="javascript:isloginout()">退出</a></span>
		  		</c:otherwise>
		  		</c:choose>
	  		</span>
	 </div>
  </body>
</html>